<?php
declare (strict_types = 1);

namespace app\subscribe;

use think\Event;


/**
 * 示例-事件观察者
 *
 * Class DemoSubscribe
 * @package app\subscribe
 * @author ^2_3^王尔贝
 */
class DemoSubscribe
{
    /**
     * 自定义事件观察者
     * @param Event $event
     * @author ^2_3^王尔贝
     */
    public function subscribe(Event $event)
    {
        $event->listen('DemoEvent', [$this, 'onDemoEvent']);
    }

    /**
     *
     * @param $eventProperty
     * @author ^2_3^王尔贝
     */
    public function onDemoEvent($eventProperty)
    {
        var_dump("事件观察者-处理(DemoEvent->DemoSubscribe)：{$eventProperty}");
    }
}
